﻿using System;
using System.Collections.Generic;
using System.Text;

namespace ECommerce.Library.DataStructure
{
    public class ReadOnlyCustomCollection<TGenericType> : CustomCollection<TGenericType>, IEnumerable<TGenericType>
    {
        public ReadOnlyCustomCollection(){}

        public ReadOnlyCustomCollection(List<TGenericType> items)
        {
            this._items = items;
        }

        public TGenericType this[int index]
        {
            get { return this._items[index]; }
        }

        #region IEnumerable Members

        public new System.Collections.IEnumerator GetEnumerator()
        {
            return new ReadOnlyCustomCollectionEnumerator<TGenericType>(this);
        }

        #endregion

        #region IEnumerable<TGenericType> Members

        IEnumerator<TGenericType> IEnumerable<TGenericType>.GetEnumerator()
        {
            return new ReadOnlyCustomCollectionEnumerator<TGenericType>(this);
        }

        #endregion
    }
}
